package cc.geguol.tcpserver.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import cc.geguol.tcpserver.pojo.Account;
import cc.geguol.tcpserver.mapper.AccountDao;

@Service
public class AccountService{

    @Resource
    private AccountDao accountDao;
    /**
     * 事务控制？
     */
//    @Transactional(
//            readOnly = false,  // 读写事务
//            timeout = -1,       // 事务的超时时间不限制
//            //noRollbackFor = ArithmeticException.class,  // 遇到数学异常不回滚
//            isolation = Isolation.DEFAULT,              // 事务的隔离级别，数据库的默认
//            propagation = Propagation.REQUIRED			// 事务的传播行为
//    )
    public int insert(Account pojo){
        return accountDao.insert(pojo);
    }

    public int insertSelective(Account pojo){
        return accountDao.insertSelective(pojo);
    }

    public int insertList(List<Account> pojos){
        return accountDao.insertList(pojos);
    }

    public int update(Account pojo){
        return accountDao.update(pojo);
    }
}
